package de.fhhannover.inform.itteam.snmpnetviz.gui;

import prefuse.action.layout.graph.ForceDirectedLayout;
import prefuse.visual.EdgeItem;
import prefuse.visual.VisualItem;

public class SnmpForceDirectedLayout extends ForceDirectedLayout {

	public SnmpForceDirectedLayout(String arg0, boolean arg1) {
		super(arg0, arg1);
	}
	
	@Override
	protected float getMassValue(VisualItem arg0) {
		return 1.6f;
	}
	
	@Override
	protected float getSpringLength(EdgeItem arg0) {
		if(arg0.getTargetNode().getString("type").equals("switch")) {
			return new Double(arg0.getTargetItem().getBounds().getWidth()+arg0.getSourceItem().getBounds().getWidth()).floatValue()*2;
		}
		return new Double(arg0.getTargetItem().getBounds().getWidth()+arg0.getSourceItem().getBounds().getWidth()).floatValue()+20;
	}

}
